<?php
/**
 * 助记词
 */
namespace app\common\model;

use think\Model;

class Mnemonic extends Model
{
    protected $name = 'mnemonic';

    /**
     * 获取所有助记词
     * @return Mnemonic[]|array|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function getList(){
        return self::order('id desc')->select();
    }

    /**
     * 随机获取数据
     * @param int $num
     * @return mixed
     */
    public static function getRand($num = 15){
        return self::orderRaw('rand()')->limit($num)->select()->toArray();
    }
}